<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/common/header.jsp"%>
<html>
<body class="easyui-layout list_body">
	<form id="menuForm" name="menuForm">
		<div class="list_body_north" data-options="region:'north'"  border="false" >
			<!-- 查询表单 -->
			<div  class="datagrid-toolbar" border="false"  >
				<span>交易开始日期:</span>
				<input type="text" id="loc_dt_start" value="${currentDate}" name="loc_dt_start" class="easyui-datebox" data-options="editable:false"/>
				<span>交易结束日期:</span>
				<input type="text" id="loc_dt_end" value="${currentDate}" name="loc_dt_end" class="easyui-datebox" data-options="editable:false"/>
				<span>会员编号:</span>
				<input type="text" id="custom_no" name="custom_no" class="easyui-textbox" /> 
				<span>会员名称:</span> 
				<input type="text" id="custom_name" name="custom_name" class="easyui-textbox" /> 
				<br/>
				<span>交易卡号:</span>
				<input type="text" id="act_out_no" name="act_out_no" class="easyui-textbox" /> 
				<span>本地流水号:</span>
				<input type="text" id="loc_trace_no" name="loc_trace_no" class="easyui-textbox" /> 
				<span>终端流水号:</span>
				<input type="text" id="snd_trace_no" name="snd_trace_no" class="easyui-textbox" /> 
				<span>渠道方流水号:</span>
				<input type="text" id="trf_trace_no" name="trf_trace_no" class="easyui-textbox" /> 
				<br/>
				<span>APP所属机构号:</span>
				<input type="text" id="ins_uuid" name="ins_uuid" class="easyui-textbox" /> 
				<span>会员手机号:</span>
				<input type="text" id="custom_login_id" name="custom_login_id" class="easyui-textbox" />
				<span>交易结果:</span>
				<code:codeSelect name="rspcode" id="rspcode" code_type="RSPCODE" showSelect="true" ></code:codeSelect>
				<span>清算日期:</span>
				<input type="text" id="loc_stl_dt" name="loc_stl_dt" class="easyui-datebox" class="easyui-textbox" />
				<br/>
				<span>业务名称:</span>
				<input class="easyui-combobox" type="text" name="service_uuid" id="service_uuid"  >
				<span>业务参数名称:</span>
				<input class="easyui-combobox" type="text" name="service_param_uuid" id="service_param_uuid" 
						data-options="valueField:'SERVICE_PARAM_UUID', textField:'PARAM_NAME',editable:false," >
				<span>渠道清算流水号:</span>
				<input type="text" id="trf_stl_trace_no" name="trf_stl_trace_no" class="easyui-textbox" /> 
				<a href="#" class="easyui-linkbutton btn" iconCls="icon-search" onclick="doSearch()">查询</a>
				<a href="#" class="easyui-linkbutton btn" iconCls="icon-reload" onclick="resetForm()">重置</a>				
			</div>
			<!-- 自定义标签工具栏 -->
			<jiepos:buttonOperateTag menuCode="${menuCode}"></jiepos:buttonOperateTag>	
		</div>
		<div data-options="region:'center'" border="false"  class="list_body_center">		
			<!-- 表格 -->
			<table id="menuTableId" fit="true"></table>
		</div>
	</form>
</body>

<script type="text/javascript">
	var grid;
	$(function() {
		//加载业务名称数据
		$('#service_uuid').combobox({
	        url:"../serviceParam/getAllService.do",
	        valueField:'SERVICE_UUID',
	        textField:'SERVICE_NAME',
	        editable:false,
	        onChange:function(record){
	                var value = $('#service_uuid').combobox('getValue');
	                loadServiceParamsInf(value);
	        }
		});
		$("#service_param_uuid").combobox({
			onShowPanel : function () {
				if($("input[name='service_uuid']").val() == '' || $("input[name='service_uuid']").prev().val() == ''){
					$.jpmessage.warning("请先选择业务名称！");
					$(this).combo('hidePanel', true);
				}
 			}
 		});
		/*加载表格数据*/
		grid = $("#menuTableId").jpgrid({
			url : "getTransactionLogListJson.do",
			baseColumns: false,
			columns : [ {
				title : "本地交易日期",
				field : "LOC_DT",
				align : 'center',
				width : 150
			}, {
				title : "订单号",
				field : "ORDER_NO",
				align : 'center',
				width : 150
			}, {
				title : "业务名称",
				field : "SERVICE_NAME",
				align : 'center',
				width : 120
			}, {
				title : "业务参数名称",
				field : "PURPOSE_NAME",
				align : 'center'
			}, {
				title : "会员编号",
				field : "CUSTOM_NO",
				align : 'center',
				width : 140
			}, {
				title : "会员名称",
				field : "CUSTOM_NAME",
				align : 'center',
				width : 150
			}, {
				title : "APP所属机构",
				field : "APP_INS_CN_NM",
				align : 'center',
				width : 220
			}, {
				title : "批次号",
				field : "CYCLE_NO",
				align : 'center',
				width : 90
			}, {
				title : "本地流水号",
				field : "LOC_TRACE_NO",
				align : 'center',
				width : 150
			}, {
				title : "终端流水号",
				field : "SND_TRACE_NO",
				align : 'center',
				width : 100
			}, {
				title : "渠道方流水号",
				field : "TRF_TRACE_NO",
				align : 'center',
				width : 130
			}, {
				title : "发卡行名称",
				field : "CARD_INS_NM",
				align : 'center',
				width : 150
			}, {
				title : "交易卡号",
				field : "ACT_OUT_NO",
				align : 'center',
				width : 130
			}, {
				title : "收款账号",
				field : "ACT_IN_NO",
				align : 'center',
				width : 130
			}, {
				title : "卡类型",
				field : "CRD_TYPE",
				align : 'center',
				width : 80
			}, {
				title : "交易金额",
				field : "TRANS_AT",
				align : 'center',
				width : 80
			}, {
				title : "最小手续费",
				field : "SERVICE_MINFEE",
				align : 'center',
				width : 80
			}, {
				title : "交易扣率",
				field : "SERVICE_DISC",
				align : 'center',
				width : 80
			}, {
				title : "封顶手续费",
				field : "SERVICE_DISC_MAXFEE",
				align : 'center',
				width : 80
			}, {
				title : "附加手续费",
				field : "SERVICE_ATTACHFEE",
				align : 'center',
				width : 80
			}, {
				title : "会员手续费",
				field : "MIDFEE",
				align : 'center',
				width : 80
			}, {
				title : "清算金额",
				field : "STL_AMT",
				align : 'center',
				width : 80
			}, {
				title : "交易结果",
				field : "RSPCODE",
				align : 'center',
				width : 200
			}, {
				title : "交易状态",
				field : "TRS_STAT",
				align : 'center',
				width : 80
			}, {
				title : "出款时间",
				field : "PAY_DT",
				align : 'center',
				width : 150
			}, {
				title : "清算状态",
				field : "STLST",
				align : 'center',
				width : 80
			}, {
				title : "渠道方清算流水号",
				field : "TRF_STL_TRACE_NO",
				align : 'center',
				width : 180
			}, {
				title : "清算状态描述",
				field : "STL_ST_DESC",
				align : 'center',
				width : 180
			}, {
				title : "本地清算日期",
				field : "LOC_STL_DT",
				align : 'center',
				width : 80
			}, {
				title : "比对状态",
				field : "CKSTAT",
				align : 'center',
				width : 80
			}, {
				title : "GPS定位信息",
				field : "GPS",
				align : 'center',
				width : 200
			}]
		});
	});

	function doSearch() {
		grid.load({
			loc_dt_start : $('#loc_dt_start').val(),
			loc_dt_end : $('#loc_dt_end').val(),
			custom_no : $('#custom_no').val(),
			custom_name : $('#custom_name').val(),
			custom_no : $('#custom_no').val(),
			act_out_no : $('#act_out_no').val(),
			loc_trace_no : $('#loc_trace_no').val(),
			snd_trace_no : $('#snd_trace_no').val(),
			ins_uuid : $('#ins_uuid').val(),
			custom_login_id : $('#custom_login_id').val(),
			rspcode : $('#rspcode').val(),
			trf_trace_no : $('#trf_trace_no').val(),
			loc_stl_dt : $('#loc_stl_dt').val(),
			service_uuid : $('#service_uuid').val(),
			service_param_uuid : $('#service_param_uuid').val(),
			trf_stl_trace_no : $('#trf_stl_trace_no').val()
		});
	}
	
	/**
	 *点击业务的时候载入业务参数数据
	 */
	function loadServiceParamsInf(value) {
		$('#service_param_uuid').combobox('clear');
		$('#service_param_uuid').combobox('reload',
				'../serviceParam/getAllServiceParams.do?service_uuid=' + value)
	}
	function exportFile(url) {
		var checkedItems = $('#menuTableId').datagrid('getChecked');
		if (!checkedItems) {
			return false;
		}
		var ids = "";
		for (var i = 0; i < checkedItems.length; i++) {
			ids = ids + "," + (checkedItems[i]).UUID;
		}
		ids = replaceFirst(ids);
		commonFileDownload(url + ids, "menuForm");
	}
</script>
</html>
